package gavdi.dk.model;

import java.io.Serializable;
import java.util.Date;
import java.util.GregorianCalendar;

import android.os.Parcelable;



public abstract class Event implements Serializable, Comparable<Object>{

	private String id;
	private String date;
	private String hours;
	private String status;
	private String comment;
	private String type;
	private String userID;
	
	public Event() {


	}
	
	public Event(String id, String date, String hours, String status, String comment, String type, String userID) {
		this.id = id;
		this.date = date;
		this.hours = hours;
		this.status = status;
		this.comment = comment;
		this.type = type;
		this.userID = userID;
	}


	public String getUserID() {
		return userID;
	}

	public void setUserID(String userID) {
		this.userID = userID;
	}

	public String getDate() {
		return date;
	}


	public void setDate(String date) {
		this.date = date;
	}


	public String getHours() {
		return hours;
	}


	public void setHours(String hours) {
		this.hours = hours;
	}


	public String getStatus() {
		return status;
	}


	public void setStatus(String status) {
		this.status = status;
	}


	public String getComment() {
		return comment;
	}


	public void setComment(String comment) {
		this.comment = comment;
	}


	public String getType() {
		return type;
	}


	public void setType(String type) {
		this.type = type;
	}
	
	public String getId() {
		return id;
	}public void setId(String id) {
		this.id = id;
	}

	@Override
	public String toString() {
		return "Event [id=" + id + ", date=" + date + ", hours=" + hours
				+ ", status=" + status + ", comment=" + comment + ", type="
				+ type + ", userID=" + userID + "]";
	}
	public int compareTo(Object another) {
		Event other = (Event) another;
		
		String date = other.getDate();
		int day = Integer.parseInt(date.substring(0, 2));
		int month = Integer.parseInt(date.substring(2, 4));
		int year = Integer.parseInt(date.substring(4));
		GregorianCalendar calOther = new GregorianCalendar((year-1900), (month-1), day);
		date = this.getDate();
		day = Integer.parseInt(date.substring(0, 2));
		month = Integer.parseInt(date.substring(2, 4));
		year = Integer.parseInt(date.substring(4));
		GregorianCalendar calThis = new GregorianCalendar((year-1900), (month-1), day);
		Long l = calOther.getTimeInMillis() - calThis.getTimeInMillis();
		
		return l.intValue() ;

	}






	
}
